/*     */ package com.qmsk.business.info.shop.controller;
/*     */ 
/*     */ import com.qmsk.business.info.shop.dao.ShopDAO;
/*     */ import com.qmsk.business.shopList.ShopMap;
/*     */ import com.utils.basic.IdEntity;
/*     */ import com.utils.basic.MapUtils;
/*     */ import com.utils.basic.ObjectComm;
/*     */ import com.utils.file.DownloadFile;
/*     */ import com.utils.file.GlobalParams;
/*     */ import com.utils.file.UploadFile;
/*     */ import com.utils.gson.in.GsonHeadOneRow;
/*     */ import com.utils.gson.in.ParserDataSetJson;
/*     */ import com.utils.gson.out.GsonEbRst;
/*     */ import com.utils.gson.out.GsonEbRstData;
/*     */ import com.utils.http.HttpGsonPtResponseUtils;
/*     */ import com.utils.jdbc.connection.DbConnection;
/*     */ import com.utils.web.RequestUtils;
/*     */ import com.utils.web.ResponseUtils;
/*     */ import com.utils.zip.ZipUtils;
/*     */ import java.io.File;
/*     */ import java.sql.SQLException;
/*     */ import java.util.ArrayList;
/*     */ import java.util.HashMap;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ import javax.servlet.http.HttpServletRequest;
/*     */ import javax.servlet.http.HttpServletResponse;
/*     */ import org.apache.commons.io.FileUtils;
/*     */ import org.apache.commons.lang.StringUtils;
/*     */ import org.apache.log4j.Logger;
/*     */ import org.springframework.beans.factory.annotation.Autowired;
/*     */ import org.springframework.stereotype.Controller;
/*     */ import org.springframework.transaction.annotation.Transactional;
/*     */ import org.springframework.web.bind.annotation.PathVariable;
/*     */ import org.springframework.web.bind.annotation.RequestMapping;
/*     */ 
/*     */ @Controller
/*     */ @RequestMapping({"/shop"})
/*     */ public class ShopController
/*     */ {
/*  45 */   private static final Logger logger = Logger.getLogger(ShopController.class);
/*     */ 
/*     */   @Autowired
/*     */   private ShopDAO dao;
/*     */ 
/*     */   @RequestMapping(value={"find/shopId/{shopId}/opt/{pageIdx}/{pageSize}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*     */   public void getListOpt(HttpServletRequest request, HttpServletResponse response, @PathVariable("pageIdx") Long shopId, @PathVariable("pageIdx") Integer nPageIdx, @PathVariable("pageSize") Short nPageSize)
/*     */   {
/*  70 */     nPageSize = RequestUtils.getRequestValidPageSize(nPageSize);
/*     */     try {
/*  72 */       Map params = new HashMap();
/*  73 */       MapUtils.addToMap(params, "id", shopId);
/*  74 */       MapUtils.addPercentToMap(params, "mp", 
/*  75 */         RequestUtils.getString(request, "mp"));
/*  76 */       MapUtils.addPercentToMap(params, "tel", 
/*  77 */         RequestUtils.getString(request, "tel"));
/*  78 */       MapUtils.addPercentToMap(params, "name", 
/*  79 */         RequestUtils.getString(request, "name"));
/*  80 */       MapUtils.addPercentToMap(params, "legal", 
/*  81 */         RequestUtils.getString(request, "legal"));
/*  82 */       MapUtils.addPercentToMap(params, "addr", 
/*  83 */         RequestUtils.getString(request, "addr"));
/*  84 */       MapUtils.addToMap(params, "dtCreateStart", 
/*  85 */         RequestUtils.getDate(request, "dtCreateStart"));
/*  86 */       MapUtils.addToMap(params, "dtCreateEnd", 
/*  87 */         RequestUtils.getDate(request, "dtCreateEnd"));
/*  88 */       MapUtils.addToMap(params, "cityId", 
/*  89 */         RequestUtils.getLong(request, "cityId"));
/*  90 */       MapUtils.addToMap(params, "provId", 
/*  91 */         RequestUtils.getLong(request, "provId"));
/*  92 */       MapUtils.addToMap(params, "regionId", 
/*  93 */         RequestUtils.getLong(request, "regionId"));
/*  94 */       MapUtils.addToMap(params, "status", 
/*  95 */         RequestUtils.getString(request, "status"));
/*  96 */       GsonEbRst gsonEbRst = this.dao.getGsonOfOpt(params, nPageIdx, nPageSize);
/*  97 */       ResponseUtils.setResponseResult(gsonEbRst, response);
/*     */     } catch (Exception e) {
/*  99 */       logger.error(e);
/* 100 */       ResponseUtils.setErrorMsgResponse(
/* 101 */         RequestUtils.getFindDataErrorMessage(request), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @RequestMapping(value={"find/AllShop/{pageIdx}/{pageSize}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*     */   public void getListOptChi(HttpServletRequest request, HttpServletResponse response, @PathVariable("pageIdx") Integer nPageIdx, @PathVariable("pageSize") Short nPageSize)
/*     */   {
/* 120 */     nPageSize = RequestUtils.getRequestValidPageSize(nPageSize);
/*     */     try {
/* 122 */       GsonEbRst gsonEbRst = this.dao.getGsonOfAllShop(nPageIdx, nPageSize);
/* 123 */       ResponseUtils.setResponseResult(gsonEbRst, response);
/*     */     } catch (SQLException e) {
/* 125 */       logger.error(e);
/* 126 */       ResponseUtils.setErrorMsgResponse(
/* 127 */         RequestUtils.getFindDataErrorMessage(request), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @RequestMapping(value={"find/shopId/{shopId}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*     */   public void getShop(HttpServletRequest request, HttpServletResponse response, @PathVariable("shopId") Long shopId)
/*     */   {
/*     */     try
/*     */     {
/* 137 */       GsonEbRst gsonEbRst = this.dao.getGsonOfshopId(shopId);
/* 138 */       ResponseUtils.setResponseResult(gsonEbRst, response);
/*     */     } catch (SQLException e) {
/* 140 */       logger.error(e);
/* 141 */       ResponseUtils.setErrorMsgResponse(
/* 142 */         RequestUtils.getFindDataErrorMessage(request), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @RequestMapping(value={"find/shopId/{shopId}/opt/child/{pageIdx}/{pageSize}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*     */   public void getListOptChild(HttpServletRequest request, HttpServletResponse response, @PathVariable("pageIdx") Integer nPageIdx, @PathVariable("pageSize") Short nPageSize)
/*     */   {
/* 160 */     nPageSize = RequestUtils.getRequestValidPageSize(nPageSize);
/*     */     try {
/* 162 */       Map params = new HashMap();
/* 163 */       MapUtils.addPercentToMap(params, "mp", 
/* 164 */         RequestUtils.getString(request, "mp"));
/* 165 */       MapUtils.addPercentToMap(params, "tel", 
/* 166 */         RequestUtils.getString(request, "tel"));
/* 167 */       MapUtils.addPercentToMap(params, "name", 
/* 168 */         RequestUtils.getString(request, "name"));
/* 169 */       MapUtils.addPercentToMap(params, "legal", 
/* 170 */         RequestUtils.getString(request, "legal"));
/* 171 */       MapUtils.addPercentToMap(params, "addr", 
/* 172 */         RequestUtils.getString(request, "addr"));
/* 173 */       MapUtils.addToMap(params, "dtCreateStart", 
/* 174 */         RequestUtils.getDate(request, "dtCreateStart"));
/* 175 */       MapUtils.addToMap(params, "dtCreateEnd", 
/* 176 */         RequestUtils.getDate(request, "dtCreateEnd"));
/* 177 */       MapUtils.addToMap(params, "cityId", 
/* 178 */         ObjectComm.objectToLong(RequestUtils.getLong(request, "cityId")));
/* 179 */       MapUtils.addToMap(params, "provId", 
/* 180 */         RequestUtils.getLong(request, "provId"));
/* 181 */       MapUtils.addToMap(params, "regionId", 
/* 182 */         RequestUtils.getLong(request, "regionId"));
/* 183 */       MapUtils.addToMap(params, "pId", Long.valueOf(0L));
/* 184 */       MapUtils.addToMap(params, "status", 
/* 185 */         RequestUtils.getString(request, "status"));
/* 186 */       GsonEbRst gsonEbRst = this.dao.getGsonOfOptChild(params, nPageIdx, 
/* 187 */         nPageSize);
/* 188 */       ResponseUtils.setResponseResult(gsonEbRst, response);
/*     */     } catch (Exception e) {
/* 190 */       logger.error(e);
/* 191 */       ResponseUtils.setErrorMsgResponse(
/* 192 */         RequestUtils.getFindDataErrorMessage(request), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @RequestMapping(value={"find/shopId/{shopId}/root"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*     */   public void getListOptRoot(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/*     */     try
/*     */     {
/* 209 */       Map params = new HashMap();
/* 210 */       MapUtils.addPercentToMap(params, "mp", 
/* 211 */         RequestUtils.getString(request, "mp"));
/* 212 */       MapUtils.addPercentToMap(params, "tel", 
/* 213 */         RequestUtils.getString(request, "tel"));
/* 214 */       MapUtils.addPercentToMap(params, "name", 
/* 215 */         RequestUtils.getString(request, "name"));
/* 216 */       MapUtils.addPercentToMap(params, "legal", 
/* 217 */         RequestUtils.getString(request, "legal"));
/* 218 */       MapUtils.addPercentToMap(params, "addr", 
/* 219 */         RequestUtils.getString(request, "addr"));
/* 220 */       MapUtils.addToMap(params, "dtCreateStart", 
/* 221 */         RequestUtils.getDate(request, "dtCreateStart"));
/* 222 */       MapUtils.addToMap(params, "dtCreateEnd", 
/* 223 */         RequestUtils.getDate(request, "dtCreateEnd"));
/* 224 */       MapUtils.addToMap(params, "cityId", 
/* 225 */         ObjectComm.objectToLong(RequestUtils.getDate(request, "cityId")));
/* 226 */       MapUtils.addToMap(params, "provId", 
/* 227 */         RequestUtils.getLong(request, "provId"));
/* 228 */       MapUtils.addToMap(params, "regionId", 
/* 229 */         RequestUtils.getLong(request, "regionId"));
/* 230 */       MapUtils.addToMap(params, "pId", Long.valueOf(0L));
/* 231 */       MapUtils.addToMap(params, "status", 
/* 232 */         RequestUtils.getInt(request, "status"));
/* 233 */       GsonEbRst gsonEbRst = this.dao.getGsonOfOptRoot(params, Integer.valueOf(0), Short.valueOf((short) 1));
/* 234 */       ResponseUtils.setResponseResult(gsonEbRst, response);
/*     */     } catch (Exception e) {
/* 236 */       logger.error(e);
/* 237 */       ResponseUtils.setErrorMsgResponse(
/* 238 */         RequestUtils.getFindDataErrorMessage(request), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @RequestMapping(value={"find/shopId/{shopId}/pId/{pId}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*     */   public void getListOptPid(HttpServletRequest request, HttpServletResponse response, @PathVariable("pId") Long pId)
/*     */   {
/*     */     try
/*     */     {
/* 255 */       Map params = new HashMap();
/* 256 */       MapUtils.addPercentToMap(params, "mp", 
/* 257 */         RequestUtils.getString(request, "mp"));
/* 258 */       MapUtils.addPercentToMap(params, "tel", 
/* 259 */         RequestUtils.getString(request, "tel"));
/* 260 */       MapUtils.addPercentToMap(params, "name", 
/* 261 */         RequestUtils.getString(request, "name"));
/* 262 */       MapUtils.addPercentToMap(params, "legal", 
/* 263 */         RequestUtils.getString(request, "legal"));
/* 264 */       MapUtils.addPercentToMap(params, "addr", 
/* 265 */         RequestUtils.getString(request, "addr"));
/* 266 */       MapUtils.addToMap(params, "dtCreateStart", 
/* 267 */         RequestUtils.getDate(request, "dtCreateStart"));
/* 268 */       MapUtils.addToMap(params, "dtCreateEnd", 
/* 269 */         RequestUtils.getDate(request, "dtCreateEnd"));
/* 270 */       MapUtils.addToMap(params, "cityId", 
/* 271 */         ObjectComm.objectToLong(RequestUtils.getDate(request, "cityId")));
/* 272 */       MapUtils.addToMap(params, "provId", 
/* 273 */         RequestUtils.getLong(request, "provId"));
/* 274 */       MapUtils.addToMap(params, "regionId", 
/* 275 */         RequestUtils.getLong(request, "regionId"));
/* 276 */       MapUtils.addToMap(params, "pId", pId);
/* 277 */       MapUtils.addToMap(params, "status", 
/* 278 */         RequestUtils.getString(request, "status"));
/* 279 */       GsonEbRst gsonEbRst = this.dao.getGsonOfOptPid(params, Integer.valueOf(0), Short.valueOf((short) 10));
/* 280 */       ResponseUtils.setResponseResult(gsonEbRst, response);
/*     */     } catch (Exception e) {
/* 282 */       logger.error(e);
/* 283 */       ResponseUtils.setErrorMsgResponse(
/* 284 */         RequestUtils.getFindDataErrorMessage(request), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @RequestMapping(value={"find/shopId/{shopId}/id/{id}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*     */   public void getListPage(HttpServletRequest request, HttpServletResponse response, @PathVariable("id") Long id, @PathVariable("pageIdx") Integer nPageIdx, @PathVariable("pageSize") Short nPageSize)
/*     */   {
/* 302 */     nPageSize = Short.valueOf((short) 1);
/*     */     try {
/* 304 */       GsonEbRst gsonEbRst = this.dao.getGsonOfId(id, Integer.valueOf(0), nPageSize);
/* 305 */       ResponseUtils.setResponseResult(gsonEbRst, response);
/*     */     } catch (SQLException e) {
/* 307 */       logger.error(e);
/* 308 */       ResponseUtils.setErrorMsgResponse(
/* 309 */         RequestUtils.getFindDataErrorMessage(request), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   private Long insertToPt(ParserDataSetJson p, HttpServletResponse response) throws Exception
/*     */   {
/* 315 */     p.delHead(new String[] { "id", "paySms", "cardFlag" });
/* 316 */     String requestData = "data=" + p.objectToJsonStr();
/* 317 */     GsonEbRst rst = null;
/* 318 */     rst = HttpGsonPtResponseUtils.postPtEbRst("ptshop/insert", requestData, 
/* 319 */       response);
/* 320 */     if ((rst != null) && (rst.isExistsData())) {
/* 321 */       return ObjectComm.objectToLong(rst.getResult().getValueOfIdx(0, 
/* 322 */         "id"));
/*     */     }
/* 324 */     logger.error("Synchronous data failed[crm/pt-Shop]:" + requestData);
/* 325 */     return null;
/*     */   }
/*     */ 
/*     */   @Transactional
/*     */   @RequestMapping(value={"insert/shopId/{shopId}"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*     */   public void insert(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/* 341 */     String sGsonInData = request.getParameter("data");
/*     */     try {
/* 343 */       int nResult = 0;
/* 344 */       ParserDataSetJson p = ParserDataSetJson.fromString(sGsonInData);
/* 345 */       if (p == null) {
/* 346 */         ResponseUtils.setErrorMsgResponse("请求错误", response);
/* 347 */         return;
/*     */       }
/* 349 */       Long shopId = null;
/* 350 */       nResult = this.dao.applyUpdates(p, "id");
/* 351 */       if ((nResult > 0) && (p.isExistsInsertRows())) {
/* 352 */         for (GsonHeadOneRow g : p.getListInsertRows()) {
/* 353 */           shopId = ObjectComm.objectToLong(g.getValueOfName("id"));
/*     */ 
/* 356 */           String path = mergeApacheSubUrl(
/* 357 */             GlobalParams.getGlobalParams().getApacheUrl(), shopId, 
/* 358 */             "img/");
/* 359 */           for (int i = 0; i < 5; ++i) {
/* 360 */             String fldName = null;
/* 361 */             switch (i)
/*     */             {
/*     */             case 0:
/* 363 */               fldName = "imgURL";
/* 364 */               break;
/*     */             case 1:
/* 366 */               fldName = "imgURL1";
/* 367 */               break;
/*     */             case 2:
/* 369 */               fldName = "imgURL2";
/* 370 */               break;
/*     */             case 3:
/* 372 */               fldName = "imgURL3";
/* 373 */               break;
/*     */             case 4:
/* 375 */               fldName = "imgURL4";
/*     */             }
/*     */ 
/* 378 */             if (StringUtils.isNotEmpty(fldName)) {
/* 379 */               String url = (String)g.getValueOfName(fldName);
/* 380 */               if (StringUtils.isNotEmpty(url)) {
/* 381 */                 String ss = url
/* 382 */                   .substring(url.lastIndexOf("\\") + 1);
/* 383 */                 g.autoAddHeadData(fldName, path + ss);
/* 384 */                 this.dao.updateImgUrl(fldName, path + ss, shopId);
/*     */               }
/*     */ 
/*     */             }
/*     */ 
/*     */           }
/*     */ 
/*     */         }
/*     */ 
/*     */       }
/*     */ 
/* 399 */       Long outId = insertToPt(p, response);
/* 400 */       if (outId != null) {
/* 401 */         nResult = this.dao.updateOutId(shopId, outId);
/*     */       }
/* 403 */       if ((nResult > 0) && (outId != null)) {
/* 404 */         DbConnection.commit();
/* 405 */         ShopMap.reInitial();
/*     */       } else {
/* 407 */         DbConnection.rollback();
/*     */       }
/* 409 */       if ((nResult > 0) && (outId != null) && (shopId != null)) {
/* 410 */         String[] heads = { "id" };
/* 411 */         Object[] datas = { shopId };
/* 412 */         ResponseUtils.toGsonEbRst(heads, datas, response);
/* 413 */         return; }
/* 414 */       ResponseUtils.setSqlResultResponse(nResult, 
/* 415 */         RequestUtils.getSqlInsertDataErrorMessage(request), 
/* 416 */         response);
/*     */     }
/*     */     catch (Exception e) {
/* 419 */       DbConnection.rollback();
/* 420 */       logger.error(e);
/* 421 */       ResponseUtils.setErrorMsgResponse(
/* 422 */         RequestUtils.getSqlInsertDataErrorMessage(request) + ":" + 
/* 423 */         e.getMessage(), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @Transactional
/*     */   @RequestMapping(value={"del/shopId/{shopId}"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*     */   public void delete(HttpServletRequest request, HttpServletResponse response) {
/* 430 */     String id = RequestUtils.getStringOfId(request);
/*     */     try {
/* 432 */       String[] strParams = id.split(",");
/* 433 */       int nResult = this.dao.deleteParams(strParams);
/* 434 */       DbConnection.commit();
/* 435 */       ShopMap.reInitial();
/* 436 */       ResponseUtils.setSqlResultResponse(nResult, 
/* 437 */         RequestUtils.getSqlDeleteDataErrorMessage(request), 
/* 438 */         response);
/*     */     } catch (Exception e) {
/* 440 */       DbConnection.rollback();
/* 441 */       logger.error(e);
/* 442 */       ResponseUtils.setErrorMsgResponse(
/* 443 */         RequestUtils.getSqlDeleteDataErrorMessage(request) + ":" + 
/* 444 */         e.getMessage(), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @Transactional
/*     */   @RequestMapping(value={"edit/shopId/{shopId}"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*     */   public void update(HttpServletRequest request, HttpServletResponse response, @PathVariable("shopId") Long shopId)
/*     */   {
/* 462 */     String sData = RequestUtils.getStringOfData(request);
/*     */     try {
/* 464 */       int nResult = 0;
/* 465 */       ParserDataSetJson p = ParserDataSetJson.fromString(sData);
/* 466 */       if (p != null) {
/* 467 */         String path = mergeApacheSubUrl(GlobalParams.getGlobalParams()
/* 468 */           .getApacheUrl(), shopId, "img/");
/* 469 */         for (GsonHeadOneRow r : p.getListUpdateRows()) {
/* 470 */           for (int i = 0; i < 5; ++i) {
/* 471 */             String fldName = null;
/* 472 */             switch (i)
/*     */             {
/*     */             case 0:
/* 474 */               fldName = "imgURL";
/* 475 */               break;
/*     */             case 1:
/* 477 */               fldName = "imgURL1";
/* 478 */               break;
/*     */             case 2:
/* 480 */               fldName = "imgURL2";
/* 481 */               break;
/*     */             case 3:
/* 483 */               fldName = "imgURL3";
/* 484 */               break;
/*     */             case 4:
/* 486 */               fldName = "imgURL4";
/*     */             }
/*     */ 
/* 489 */             if (StringUtils.isNotEmpty(fldName)) {
/* 490 */               String url = (String)r.getValueOfName(fldName);
/* 491 */               if (StringUtils.isNotEmpty(url)) {
/* 492 */                 String ss = url
/* 493 */                   .substring(url.lastIndexOf("\\") + 1);
/* 494 */                 r.autoAddHeadData(fldName, path + ss);
/*     */               }
/*     */             }
/*     */           }
/* 498 */           shopId = ObjectComm.objectToLong(r.getValueOfName("id"));
/*     */         }
/*     */ 
/* 501 */         nResult = this.dao.applyUpdates(p);
/* 502 */         if ((nResult > 0) && (shopId != null)) {
/* 503 */           Long outId = ShopMap.getOutIdOfShopId(shopId);
/* 504 */           if ((outId != null) && (outId.longValue() > 0L)) {
/* 505 */             ((GsonHeadOneRow)p.getListUpdateRows().get(0))
/* 506 */               .autoAddHeadData("id", outId);
/*     */ 
/* 508 */             Integer count = updateToPt(p, response);
/* 509 */             if ((count != null) && (count.intValue() > 0)) {
/* 510 */               ShopMap.reInitial();
/* 511 */               DbConnection.commit();
/*     */             } else {
/* 513 */               DbConnection.rollback();
/*     */             }
/*     */           }
/*     */         }
/*     */         else {
/* 518 */           DbConnection.rollback();
/*     */         }
/*     */       }
/* 521 */       ResponseUtils.setSqlResultResponse(nResult, 
/* 522 */         RequestUtils.getSqlUpdateErrorMessage(sData, request), 
/* 523 */         response);
/*     */     } catch (Exception e) {
/* 525 */       DbConnection.rollback();
/* 526 */       logger.error(e);
/* 527 */       ResponseUtils.setErrorMsgResponse(
/* 528 */         RequestUtils.getSqlUpdateErrorMessage(sData, request) + ":" + 
/* 529 */         e.getMessage(), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   private Integer updateToPt(ParserDataSetJson p, HttpServletResponse response) throws Exception
/*     */   {
/* 535 */     p.delHead(new String[] { "paySms", "cardFlag" });
/*     */ 
/* 537 */     if (((GsonHeadOneRow)p.getListUpdateRows().get(0)).getDataLength() == 1) {
/* 538 */       return Integer.valueOf(1);
/*     */     }
/*     */ 
/* 541 */     String requestData = "data=" + p.objectToJsonStr();
/* 542 */     GsonEbRst rst = null;
/* 543 */     rst = HttpGsonPtResponseUtils.postPtEbRst("ptshop/edit", requestData, 
/* 544 */       response);
/* 545 */     if ((rst != null) && (rst.isExistsData())) {
/* 546 */       return ObjectComm.objectToInteger(rst.getResult().getValueOfIdx(0, 
/* 547 */         "nResult"));
/*     */     }
/* 549 */     logger.error("Synchronous data failed[crm/pt-Shop]:" + requestData);
/* 550 */     return null;
/*     */   }
/*     */ 
/*     */   @RequestMapping(value={"nav/giftImg/{giftId}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*     */   public void navigateGiftImg(HttpServletRequest request, HttpServletResponse response, @PathVariable("giftId") String giftId)
/*     */   {
/* 557 */     String fileName = RequestUtils.getString(request, "fileName");
/*     */     try {
/* 559 */       boolean bool = DownloadFile.navigate(response, 
/* 560 */         GlobalParams.getGlobalParams().getDataPath() + 
/* 561 */         "/" + 
/* 562 */         giftId + 
/* 563 */         "/" + 
/* 564 */         fileName);
/*     */     }
/*     */     catch (Exception e)
/*     */     {
/* 572 */       logger.error(e);
/* 573 */       ResponseUtils.setErrorMsgResponse("浏覻店图片出锿" + e.getMessage(), 
/* 574 */         response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @RequestMapping(value={"upload/imgUrl/{shopId}"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*     */   public void uploadFrameImg(HttpServletRequest request, HttpServletResponse response, @PathVariable("shopId") Long shopId)
/*     */   {
/*     */     try
/*     */     {
/* 591 */       String path = mergeApacheSubUrl(GlobalParams.getGlobalParams()
/* 592 */         .getApacheRoot(), shopId, "img/");
/*     */ 
/* 594 */       UploadFile.uploadFileOfRequest(request, response, path);
/* 595 */       ResponseUtils.setSuccessResponse("上传图片成功", response);
/*     */     } catch (Exception e) {
/* 597 */       logger.error(e);
/* 598 */       ResponseUtils.setErrorMsgResponse("上传图片出错:" + e.getMessage(), 
/* 599 */         response);
/*     */     }
/*     */   }
/*     */ 
/*     */   private String mergeApacheSubUrl(String sRoot, Long shopId, String sSub) {
/* 604 */     return sRoot + String.valueOf(ShopMap.getGroupIdOfShopIdDef(shopId)) + 
/* 605 */       "/" + "shop/" + String.valueOf(shopId) + "/" + 
/* 606 */       sSub;
/*     */   }
/*     */ 
/*     */   @RequestMapping(value={"upload/shopManual/{id}/{isWebUrl}"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*     */   public void uploadShopManual(HttpServletRequest request, HttpServletResponse response, @PathVariable("id") Long id, @PathVariable("isWebUrl") Integer isWebUrl)
/*     */   {
/*     */     try
/*     */     {
/* 628 */       Integer nResult = null;
/* 629 */       String itemPath = RequestUtils.getString(request, "itemPath");
/* 630 */       List fileList = new ArrayList();
/* 631 */       String tempZipPath = GlobalParams.getGlobalParams().getUploadPath() + 
/* 632 */         "tmp/" + IdEntity.getUUID(true) + "/";
/* 633 */       UploadFile.uploadFileOfRequest(request, response, tempZipPath, 
/* 634 */         fileList);
/* 635 */       for (int i = 0; i < fileList.size(); ++i)
/*     */       {
/* 638 */         String zipFilePath = tempZipPath + ((String)fileList.get(i));
/*     */ 
/* 641 */         String unZipPath = tempZipPath + "unZip/";
/*     */ 
/* 643 */         String rootFileURL = mergeApacheSubUrl(
/* 644 */           GlobalParams.getGlobalParams().getApacheRoot(), id, 
/* 645 */           "manual/");
/* 646 */         String url = mergeApacheSubUrl(GlobalParams.getGlobalParams()
/* 647 */           .getApacheUrl(), id, "manual/" + itemPath);
/*     */ 
/* 649 */         ZipUtils.unZip(zipFilePath, unZipPath, "UTF-8");
/* 650 */         FileUtils.copyDirectory(new File(unZipPath), 
/* 651 */           new File(rootFileURL));
/*     */ 
/* 653 */         FileUtils.deleteDirectory(new File(tempZipPath));
/* 654 */         nResult = Integer.valueOf(this.dao.updateIndexUrl(id, url));
/*     */ 
/* 656 */         Long outId = ShopMap.getOutIdOfShopId(id);
/* 657 */         if ((isWebUrl.intValue() == 1) && (nResult.intValue() > 0) && 
/* 658 */           (outId != null) && (outId.longValue() > 0L)) {
/* 659 */           GsonHeadOneRow g = new GsonHeadOneRow(new String[] { 
/* 660 */             "idxUrl", "id" }, new Object[] { url, outId });
/* 661 */           ParserDataSetJson p = new ParserDataSetJson();
/* 662 */           List edit = new ArrayList();
/* 663 */           edit.add(g);
/* 664 */           p.setListUpdateRows(edit);
/* 665 */           nResult = updateToPt(p, response);
/*     */         }
/*     */ 
/* 668 */         if ((nResult != null) && (nResult.intValue() > 0)) {
/* 669 */           DbConnection.commit();
/* 670 */           ResponseUtils.setSuccessResponse("上传手册成功", response);
/*     */         } else {
/* 672 */           DbConnection.rollback();
/* 673 */           ResponseUtils.setErrorMsgResponse("上传手册出错", response);
/*     */         }
/*     */ 
/*     */       }
/*     */ 
/*     */     }
/*     */     catch (Exception e)
/*     */     {
/* 684 */       logger.error(e);
/* 685 */       ResponseUtils.setErrorMsgResponse("上传手册出错:" + e.getMessage(), 
/* 686 */         response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @RequestMapping(value={"find/shopAll/{pageIdx}/{pageSize}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*     */   public void findRecommendShopList(HttpServletRequest request, HttpServletResponse response, @PathVariable("pageIdx") Integer nPageIdx, @PathVariable("pageSize") Short nPageSize)
/*     */   {
/* 704 */     nPageSize = RequestUtils.getRequestValidPageSize(nPageSize);
/*     */     try {
/* 706 */       Map params = new HashMap();
/* 707 */       params.put("operateTypeId", RequestUtils.getString(request, "operateTypeId"));
/*     */ 
/* 709 */       GsonEbRst rst = this.dao.findRecommendShopList(params, nPageIdx, nPageSize);
/* 710 */       ResponseUtils.setResponseResult(rst, response);
/*     */     } catch (Exception e) {
/* 712 */       logger.error(e);
/* 713 */       ResponseUtils.setErrorMsgResponse(
/* 714 */         RequestUtils.getFindDataErrorMessage(request), response);
/*     */     }
/*     */   }
/*     */ }

/* Location:           C:\Users\Administrator\Desktop\新建文件夹\WEB-INF\classes\
 * Qualified Name:     com.qmsk.business.info.shop.controller.ShopController
 * JD-Core Version:    0.5.3
 */